package main

import (
	"flag"
	"fmt"
	"os/exec"
)

var (
	argDir = flag.String("d", "../build", "build out dir")
)

var (
	cmds = map[string]string{
		"client":  "client/client.go",
		"station": "station/station.go",
		"lucky":   "lucky/luckyaddr.go",
	}
)

func gotool(tool string) *exec.Cmd {
	args := []string{tool}
	return exec.Command("go", args...)
}

func main() {
	flag.Parse()
	for k, v := range cmds {
		gobuild := gotool("build")
		gobuild.Args = append(gobuild.Args, "-o", *argDir+"/"+k, "cmd/"+v)
		fmt.Println(gobuild.Args)
		gobuild.Run()
	}
}
